<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$appConfigs.title}</title>

    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/{$page_theme | default: 'default'}/easyui.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/style/my.css">
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/javascript/my.js"></script>
    
</head> 
<body onpageshow="resetPagination('dg')">
    {datagrid id="dg" datasource="/invest/DiscoveryOpportunityService/findAll.do" view="i_discovery_opportunity"}
    {form id="dlg" view="i_discovery_opportunity" }
    
    <script>
    field_formatters.status=function (value, row, index){
		if(value == 0)
			return '<font color="red">待处理</font>';
		else if(value == 1)
			return '<font color="green">已投资</font>';
		else if(value == 2)
			return '<font color="green">已建议</font>';
		else if(value == 3)
			return '<font color="green">已交易</font>';
		else if(value == 4)
			return '<font color="red">已取消</font>';
    }
    field_formatters.create_time=function (value, row, index){
		if(value)
			return value.substring(0,10);
    }
    field_formatters.transaction_date=function (value, row, index){
		if(value)
			return value.substring(0,10);
    }
    field_formatters.transaction_type=function (value, row, index){
        if(value == 1)
		    return "<font color='green'>买入</font>";
        else
		    return "<font color='red'>卖出</font>";
    }
    field_formatters.tax=function (value, row, index){
		return formatCurrency(value);
    }
    
    function showTransactions() {
	    var row = getDatagrid('dg').datagrid('getSelected');
	    if(row) {
	    	window.parent.openTab(row.name + '的交易','/invest/invest/transaction_invest.shtml?invest_id='+row.invest_id+'&price='+row.price);
	    } else {
			alert('没有选择投资项目！');
	    }
    }
    function showStrategies() {
	    var row = getDatagrid('dg').datagrid('getSelected');
	    if(row) {
	    	window.parent.openTab(row.name + '的策略','/invest/invest/strategy.shtml?invest_id='+row.invest_id);
	    } else {
			alert('没有选择投资项目！');
	    }
    }
    function showSuggestions() {
	    var row = getDatagrid('dg').datagrid('getSelected');
	    if(row) {
	    	window.parent.openTab(row.name + '的建议','/invest/invest/suggestion.shtml?invest_id='+row.invest_id);
	    } else {
			alert('没有选择投资项目！');
	    }
    }
    function showInvestSummary() {
	    var row = getDatagrid('dg').datagrid('getSelected');
	    if(row) {
	    	window.parent.openTab(row.name + '的统计','/invest/report/invest_summary.shtml?invest_id='+row.invest_id);
	    } else {
			alert('没有选择投资项目！');
	    }
    }
    </script>
</body>
</html>